#include <iostream>
#include <cstring>
#include <unordered_set>
using namespace std;

int main() {
    string s1,s2;
    getline(cin,s1);
    getline(cin,s2);

    unordered_set<char> has(s2.begin(),s2.end());

    for(int i=0;i<s1.size();i++)
    {
        if(has.count(s1[i]))
            continue;

        cout<<s1[i];
    }
    
    return 0;
}
